'''
Created on Nov 25, 2010

@author: philip
'''
from django.db import models

class Community(models.Model):
    name = models.CharField(max_length=50)
    urlName = models.CharField(max_length=50)
    lat = models.FloatField()
    lon = models.FloatField()
    
    def save(self, *args, **kwargs):
        self.urlName = Community.name2UrlName(self.name) 
        super(Community, self).save(*args, **kwargs)

    @staticmethod
    def name2UrlName(name):
        return name.lower()